#if !defined(APP_H_INCLUDED)
#define APP_H_INCLUDED

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "StdAfx.h"

#ifndef DLLAPI
#define DLLAPI extern "C" __declspec( dllimport )
#endif

typedef int SINT;

typedef VOID (*PFGameInit)(LPCTSTR szFolder, SINT nWidth, SINT nHeight);
typedef LONG (*PFGameUpdate)(UINT);
typedef VOID (*PFGameRender)();
typedef VOID (*PFGameMessage)(UINT, DWORD, DWORD);
typedef VOID (*PFGameFree)();

/////////////////////////////////////////////////////////////////////////////
// CApp
// Application class

#include "GMsgDef.h"

class CApp
{
protected:
	HINSTANCE	m_hInst;
	HWND		m_hWnd;
	HGLRC		m_hRC;		// Handle to RC

public:
	CApp();
	~CApp();

	BOOL InitInstance(HINSTANCE hInstance, int nCmdShow, LPSTR lpCmdLine);	
	BOOL Load(LPCTSTR szIniFile);
	int Run();
	void OnIdle();
	void ExitInstance();

	BOOL OnCommand(int nCmdID, int nEvent);
	LRESULT WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);

	void OnCreate();
	void OnSize(int cx, int cy);
	void OnPaint(HDC hDC);
	void OnDestroy();

	void OnKeydown(WPARAM wParam, LPARAM lParam);
	void OnKeyChar(WPARAM wParam, LPARAM lParam);
	void OnKeyup(WPARAM wParam, LPARAM lParam);
	void OnMouseMove(WPARAM wParam, LPARAM lParam);
	void OnLButtonDown(WPARAM wParam, LPARAM lParam);
	void OnLButtonUp(WPARAM wParam, LPARAM lParam);
	void OnMouseWheel(WPARAM wParam, LPARAM lParam);
	void OnTimer(WPARAM wParam, LPARAM lParam);

protected:
	HMODULE			m_hDll;

	PFGameInit		m_pfGameInit;
	PFGameUpdate	m_pfGameUpdate;
	PFGameRender	m_pfGameRender;
	PFGameMessage	m_pfGameMessage;
	PFGameFree		m_pfGameFree;

protected:
	int	m_nPosX;
	int m_nPosY;
	int m_nWidth;
	int m_nHeight;

	TCHAR	m_szFolder[MAX_PATH];
};

#endif // !defined(APP_H_INCLUDED)
